package com.twotiger.and.bean;

import java.io.Serializable;

import com.twotiger.and.util.DateUtil;
import com.twotiger.and.util.LogUtil;
import com.twotiger.and.util.StringUtils;

/**
 * Created by victor on 2014/10/15 0015.
 */
public class ProjectDetail extends Basebean implements Serializable {
    private static final long serialVersionUID = 1 << 2L;
    private String projectId;
    private String name;
    private String nid;
    private String mode;
    private String modeName;
    private int period;
    private double amount;
    private double yield;
    private double awardYield;
    private double awardCash;
    private double minInvest;
    private double maxInvest;
    private int repaymentType;
    private long guaranteeType;
    private String guaranteeTypeName;
    private String description;
    private long startTime;
    private String loanUse;
    private String repaymentWay;
    private int status;
    private String statusName;
    private String ctime;
    private String utime;
    private String startInterestDate;
    private String endInterestDate;
    private String certIconList;
    private String investList;
    private int investCount;
    private String repaymentList;
    private String investAmount;
    private long systime;
    private long localSysTime = System.currentTimeMillis();
    private int activityMark; //活动标志 0-无活动  1-有活动
    
    private String loanPeopleSimple;  //借款人信息(简略)
    private String loanUseSimple; //借款用途(简略)
    private String repaymentWaySimple; //还款来源(简略)
    private String certAuditSimple; //资质审核(简略)
    private String activityUrl;    //有活动的项目的活动地址
    private String activityIcon;   //活动图标地址
    private String activityName;  //活动名称
    
/*-------------------新增字段（万元体验金）--------------start*/
    
    private String repayAmount; //支付金额   
    private Double valuation;   //一元价值
    private String type;        //类型  1体验金：nid_wytyj   2普通项目：nid_common
    private String boutiqueMsg; //推荐语
    
    /*-----------------新增字段（万元体验金）end---------------*/
    
/*-------------------新增字段2.5--------------start*/
    
    private String pTypeImg; //项目类型图标   pTypeImg    String  是   V2.5新增   
    private String pTypeMsg;  //项目类型文案    pTypeMsg    String  是   V2.5新增
    
    private String pledgeType;
    
    /*-----------------新增字段2.5end---------------*/
    
    
    private String pType;  //项目类型    pType   String  是   参考字典：ProjectType
    private String remainAmount;  // 剩余可投金额  remainAmount    String  是   
    private String completeLv;  // 完成率 completeLv  String  是   
    private String assignMark;  //  是否允许转让  assignMark  String  是   0-不允许；1-允许
    private String assignMsg;  //转让文案    assignMsg   String  否   assignMark=1存在
    private String repayTypeName;  //   还款方式名称  repayTypeName   String  是   
    
    
    public String getpType() {
        return pType;
    }

    public void setpType(String pType) {
        this.pType = pType;
    }

    public String getRemainAmount() {
        return remainAmount;
    }

    public void setRemainAmount(String remainAmount) {
        this.remainAmount = remainAmount;
    }

    public String getCompleteLv() {
        return completeLv;
    }

    public void setCompleteLv(String completeLv) {
        this.completeLv = completeLv;
    }

    public String getAssignMark() {
        return assignMark;
    }

    public void setAssignMark(String assignMark) {
        this.assignMark = assignMark;
    }

    public String getAssignMsg() {
        return assignMsg;
    }

    public void setAssignMsg(String assignMsg) {
        this.assignMsg = assignMsg;
    }

    public String getRepayTypeName() {
        return repayTypeName;
    }

    public void setRepayTypeName(String repayTypeName) {
        this.repayTypeName = repayTypeName;
    }

    public String getActivityUrl() {
        return activityUrl;
    }

    public String getPledgeType() {
        return pledgeType;
    }

    public void setPledgeType(String pledgeType) {
        this.pledgeType = pledgeType;
    }

    public String getpTypeImg() {
        return pTypeImg;
    }

    public void setpTypeImg(String pTypeImg) {
        this.pTypeImg = pTypeImg;
    }

    public String getpTypeMsg() {
        return pTypeMsg;
    }

    public void setpTypeMsg(String pTypeMsg) {
        this.pTypeMsg = pTypeMsg;
    }

    public String getActivityName() {
        return activityName;
    }

    public void setActivityName(String activityName) {
        this.activityName = activityName;
    }

    public String getActivityIcon() {
        return activityIcon;
    }

    public void setActivityIcon(String activityIcon) {
        this.activityIcon = activityIcon;
    }

    public String getRepayAmount() {
        return repayAmount;
    }

    public void setRepayAmount(String repayAmount) {
        this.repayAmount = repayAmount;
    }

    public Double getValuation() {
        return valuation;
    }

    public void setValuation(Double valuation) {
        this.valuation = valuation;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBoutiqueMsg() {
        return boutiqueMsg;
    }

    public void setBoutiqueMsg(String boutiqueMsg) {
        this.boutiqueMsg = boutiqueMsg;
    }

    public void setActivityUrl(String activityUrl) {
        this.activityUrl = activityUrl;
    }

    public String getLoanPeopleSimple() {
        return loanPeopleSimple;
    }

    public void setLoanPeopleSimple(String loanPeopleSimple) {
        this.loanPeopleSimple = loanPeopleSimple;
    }

    public String getLoanUseSimple() {
        return loanUseSimple;
    }

    public void setLoanUseSimple(String loanUseSimple) {
        this.loanUseSimple = loanUseSimple;
    }

    public String getRepaymentWaySimple() {
        return repaymentWaySimple;
    }

    public void setRepaymentWaySimple(String repaymentWaySimple) {
        this.repaymentWaySimple = repaymentWaySimple;
    }

    public String getCertAuditSimple() {
        return certAuditSimple;
    }

    public void setCertAuditSimple(String certAuditSimple) {
        this.certAuditSimple = certAuditSimple;
    }

    /**倒计时*/
    private String time2Start;

    public String getTime2Start() {
        LogUtil.info(ProjectDetail.class, startTime + " " + systime);
        long t = startTime - (systime + System.currentTimeMillis() - localSysTime);
        if (t < 0) {
            time2Start = "即将开始";
        } else {
            String[] tmps = secondToDate(t / 1000);
            time2Start = tmps[0] + "小时" + tmps[1] + "分" + tmps[2] + "秒";
        }
        return time2Start;
    }

    public String[] secondToDate(long prt) {
        int hh = (int) (prt / 60 / 60);//计算剩余的小时数
        int mm = (int) (prt / 60 % 60);//计算剩余的分钟数
        int ss = (int) (prt % 60);//计算剩余的秒数
        String hh1 = checkTime(hh);
        String mm1 = checkTime(mm);
        String ss1 = checkTime(ss);
        return new String[] { hh1, mm1, ss1 };
    }

    private String checkTime(int i) {
        String tmp = "";
        if (i < 10) {
            tmp = "0" + (i < 0 ? 0 : i);
        } else {
            tmp = i + "";
        }
        return tmp;
    }

    public String getCertIconList() {
        return certIconList;
    }

    public void setCertIconList(String certIconList) {
        this.certIconList = certIconList;
    }

    public String getInvestList() {
        return investList;
    }

    public void setInvestList(String investList) {
        this.investList = investList;
    }

    public int getInvestCount() {
        return investCount;
    }

    public void setInvestCount(int investCount) {
        this.investCount = investCount;
    }

    public String getRepaymentList() {
        return repaymentList;
    }

    public void setRepaymentList(String repaymentList) {
        this.repaymentList = repaymentList;
    }

    public String getInvestAmount() {
        return investAmount;
    }

    public void setInvestAmount(String investAmount) {
        this.investAmount = investAmount;
    }

    public String getStartInterestDate() {
        return startInterestDate;
    }

    public void setStartInterestDate(String startInterestDate) {
        this.startInterestDate = startInterestDate;
    }

    public String getEndInterestDate() {
        return endInterestDate;
    }

    public void setEndInterestDate(String endInterestDate) {
        this.endInterestDate = endInterestDate;
    }

    public String getProjectId() {
        return projectId;
    }

    public void setProjectId(String projectId) {
        this.projectId = projectId;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public String getModeName() {
        return modeName;
    }

    public void setModeName(String modeName) {
        this.modeName = modeName;
    }

    public double getYield() {
        return yield;
    }

    public void setYield(double yield) {
        this.yield = yield;
    }

    public double getAwardYield() {
        return awardYield;
    }

    public void setAwardYield(double awardYield) {
        this.awardYield = awardYield;
    }

    public double getAwardCash() {
        return awardCash;
    }

    public void setAwardCash(double awardCash) {
        this.awardCash = awardCash;
    }

    public double getMinInvest() {
        return minInvest;
    }

    public void setMinInvest(double minInvest) {
        this.minInvest = minInvest;
    }

    public int getRepaymentType() {
        return repaymentType;
    }

    public void setRepaymentType(int repaymentType) {
        this.repaymentType = repaymentType;
    }

    public long getGuaranteeType() {
        return guaranteeType;
    }

    public void setGuaranteeType(long guaranteeType) {
        this.guaranteeType = guaranteeType;
    }

    public long getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = DateUtil.getDateByLong(Long.parseLong(startTime)).getTime();
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getStatusName() {
        return statusName;
    }

    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }

    public String getCtime() {
        return ctime;
    }

    public void setCtime(String ctime) {
        this.ctime = ctime;
    }

    public String getUtime() {
        return utime;
    }

    public void setUtime(String utime) {
        this.utime = utime;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public double getMaxInvest() {
        return maxInvest;
    }

    public void setMaxInvest(double maxInvest) {
        this.maxInvest = maxInvest;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getNid() {
        return nid;
    }

    public void setNid(String nid) {
        this.nid = nid;
    }

    public String getGuaranteeTypeName() {
        if (StringUtils.isEmpty(guaranteeTypeName)) {
            return "";
        }
        return guaranteeTypeName;
    }

    public void setGuaranteeTypeName(String guaranteeTypeName) {
        this.guaranteeTypeName = guaranteeTypeName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getLoanUse() {
        return loanUse;
    }

    public void setLoanUse(String loanUse) {
        this.loanUse = loanUse;
    }

    public String getRepaymentWay() {
        return repaymentWay;
    }

    public void setRepaymentWay(String repaymentWay) {
        this.repaymentWay = repaymentWay;
    }

    public int getPeriod() {
        return period;
    }

    public void setPeriod(int period) {
        this.period = period;
    }

    public int getActivityMark() {
        return activityMark;
    }

    public void setActivityMark(int activityMark) {
        this.activityMark = activityMark;
    }

    public long getSystime() {
        return systime;
    }

    public void setSystime(String systime) {
        this.systime = DateUtil.getDateByLong(Long.parseLong(systime)).getTime();
    }
}
